package com.liangzong.betspider.task;

import com.liangzong.betspider.command.Command;
import com.liangzong.betspider.service.ManageDataService;
import lombok.extern.slf4j.Slf4j;

import static com.liangzong.betspider.utils.SpiderInfoUtil.*;

@Slf4j
public class SyncDataTask implements Runnable {
    ManageDataService manageDataService;

    public SyncDataTask(ManageDataService manageDataService) {
        this.manageDataService = manageDataService;
    }

    @Override
    public void run() {
        do {
            try {
                Command data = getData();
                if (data != null) {
                    manageDataService.manage(data);
                }
            } catch (Exception e) {
                log.error(e.getMessage(), e);
            }
        } while (true);
    }
}

